package com.wmz.factory;

import com.wmz.strategy.LoginStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wmz
 * @date 2024/7/2 22:00
 * @description 登录策略工厂类
 */
@Component
public class LoginStrategyFactory {
    @Autowired
    private Map<String,LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 根据登录类型获取具体的登录策略
     * @param loginType 登录类型
     * @return
     */
    public LoginStrategy getInstance(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
